package com.ljw.zookeeper;

import java.util.List;

/**
 * @Author: lijunwei
 * @Time: 2019/8/10 20:52
 */
public abstract class AbstractLoadBalance implements LoadBalance {

    public String selectHost(List<String> serviceRepos) {
        if (serviceRepos == null || serviceRepos.size() == 0) {
            return null;
        }
        if (serviceRepos.size() == 1) {
            return serviceRepos.get(0);
        }

        return doSelect(serviceRepos);
    }

    protected abstract String doSelect(List<String> serviceRepos);
}
